package com.hongling;

import com.hongling.uc.service.DemoService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@SpringBootApplication
//启用feign客户端，可配置多个
@EnableFeignClients(basePackages ={"com.hongling.uc.service"})
//声明为Controller入口
@RestController
public class UcWebApplication {

	public static void main(String[] args) {
		SpringApplication.run(UcWebApplication.class, args);
	}

	@Resource
	private DemoService demoService;

	@RequestMapping(value = "/hi", method = RequestMethod.GET)
	public String sayHi(@RequestParam String name) {
		return demoService.sayHi(name);
	}

	@RequestMapping(value = "/getUser", method = RequestMethod.GET)
	public String getUser(@RequestParam Integer id) {
		return demoService.getUserById(id).toString();
	}

}
